package ar.uba.fi.taller2.TreesWeb.ui;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Iterator;

import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Textbox;

import ar.uba.fi.taller2.TreesWeb.ui.Lookup;
import ar.uba.fi.taller2.TreesWeb.ui.initiator.ParametersInit;
import ar.uba.fi.taller2.TreesWeb.*;

public class ConfigurationWindow extends DefaultWindow
{
	public static List params;
	
	public void onCreate()
	{
		
	}

	public void onCancel() 
	{
		this.setVisible(false);
		Component C = this.getParent();
		C.invalidate();
	}
	
	
	public void onOK( ) throws Exception
	{
		List <Lookup>L = ParametersInit.getLookups();
		Iterator <Lookup>i = L.iterator();
		while (i.hasNext()){
			Lookup lk = (Lookup)i.next();
			String nombre =  lk.getCode();	
			Textbox tb = (Textbox)this.getFellow(nombre);
			String valor = tb.getText();		
			lk.setValue(valor);
			Parameters.getParametros().setMessage(nombre , 1, valor);			
		}
		this.setVisible(false);
		Component C = this.getParent();
		C.invalidate();
	}

	
}
